﻿<UserControl
    x:Class="Invaders.View.AnimatedImage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Invaders.View"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    
    <Grid>
        <Grid.Resources>
            <Storyboard x:Name="invaderShotStoryboard">
                <DoubleAnimation From="1" To="0" Storyboard.TargetName="image"
                        Storyboard.TargetProperty="Opacity" Duration="0:0:0.5" />
            </Storyboard>
            <Storyboard x:Name="flashStoryboard">
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="Visibility" RepeatBehavior="Forever">
                    <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                    <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="Collapsed"/>
                    <DiscreteObjectKeyFrame KeyTime="0:0:0.8" Value="Visible"/>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </Grid.Resources>
        <Image x:Name="image" Stretch="Fill"/>
    </Grid>
</UserControl>
